import random
import string

def generate_captcha():
    captcha=''.join(random.choices(string.ascii_letters,k=4))
    return captcha

def main():
    captcha=generate_captcha()
    print(f"生成验证码是：{captcha}")
    user_input=input("请输入验证码：")
    if user_input==captcha:
        print("验证码正确！")
    else:
        print("验证码错误！")

main()